home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 1 / ETO Development Tools 1.iso / Essentials / MacApp Documentation / MacApp AppleLink Messages / MacApp.Tech$ 6⁄29⁄90 / 1490-Re[2] Feedback in Ma-Jun90 < prev    next >
Encoding:
Text File  |  1990-06-29  |  1.6 KB  |  60 lines  |  [TEXT/GEOL]

  1. Item    6311447                         25-June-90        11:39PDT
  2.  
  3. From:   D4684                           Robins Analytics, S Robins,PRT
  4.  
  5. To:     MACDTS                          Macintosh Developer Tech Supt
  6.  
  7. cc:     D4695                           Skywalker Sys, Scott Collins,PRT
  8.         MACAPP.TECH$                    MacApp Technical
  9.  
  10. Sub:    Re: RE-Feedback in MacApp
  11.  
  12. MG - the EMail Slave and Scott,
  13.     I didn't word my question right. I not only want a dialog that gives
  14. feedback but I also need it to be able to be cancelled by a command-period.
  15. That is why I figured it needed to intercept events. In any case I have decided
  16. instead to create a routine FailCommandPeriod(error:OSErr); that would fail if
  17. command period was hit. See the below code.
  18.  
  19.    PROCEDURE FailCommandPeriod(error:OSErr);
  20.  
  21.    CONST
  22.    myDlgMask = mDownMask + mUpMask + keyDownMask + keyUpMask + autoKeyMask;
  23.  
  24.  
  25.    VAR
  26.    ch: CHAR;
  27.    keycode: INTEGER;
  28.    anEvent: EventRecord;
  29.  
  30.    BEGIN
  31.    IF gApplication.GetEvent(myDlgMask, 0, NIL, anEvent) THEN
  32.    BEGIN
  33.    CASE anEvent.what OF
  34.    keyDown:
  35.    WITH anEvent DO
  36.    BEGIN
  37.    ch := CHR(BAND(message, charCodeMask));
  38.    keycode := BSR(BAND(message, keyCodeMask), 8);
  39.    IF ((ch = '.') & (BAND(modifiers, cmdKey) <> 0)) | ((ch = chEscape) &
  40. (keycode = kEscapeVirtualCode)) THEN
  41.    BEGIN
  42.    FAILURE(error, 0);
  43.    END;
  44.    END;
  45.    END;
  46.    END;
  47.    END;
  48.  
  49. This code is stolen partially from the TStdPrintHandler's print idler
  50. procedure. It works but obviously it requires that you know how to fail
  51. gracefully from wherever it is called. Easier said than done.
  52.  
  53. Thanks for the responses,
  54.  
  55. Doug Ahmann
  56. Robins Analytics
  57. St. Paul
  58. ALink D4684
  59.  
  60.